package com.itcam.statics;

import com.itcam.Calculator;

/**
 * Author:Cammy.Wu
 * Date:2024-04-25
 * Description: 代理类【中介】
 */

public class StaticProxyCaculator implements Calculator {

    private Calculator calculator;

    // 使用构造函数传入目标（房东）
    public StaticProxyCaculator(Calculator target) {
        this.calculator = target;
    }

    @Override
    public int add(int i, int j) {
        System.out.println("i = " + i + ", j = " + j);

        int result = calculator.add(i, j);

        System.out.println("result = " + result);

        return result;
    }

    @Override
    public int sub(int i, int j) {
        return 0;
    }

    @Override
    public int mul(int i, int j) {
        return 0;
    }

    @Override
    public int div(int i, int j) {
        return 0;
    }
}
